<template>
  <div>
    <div class="container" v-if="data && ranList">
        <div class="prodetail">
          <div class="left" v-html="full_details">
        </div>
        <div class="right">
        <h2>婚礼套餐推荐</h2>
        <hot-sell-cell 
         v-for="item in ranList"
          :key="item.pid"
          :item="item"
        ></hot-sell-cell>
      </div>
        </div>
    </div>
  </div>
</template>

<script>
import HotSellCell from '@/components/HotSellCell.vue';
export default {
  components: { HotSellCell },
    computed: {
       full_details() {
      return this.data[0].pp_prodetail.replace(
        /src="./g,
        `src="`
      )
    },
    },
  methods: {
    getRanData() {
      const url = "/companys/productsRandom?n=12"
      this.axios.get(url).then((res) => {
        // console.log(res)
        console.log('ran的res',res)
        this.ranList = res.data.data
      })
    },
    getData() {
      const url = `/v2/worker/photo_prodetail/${this.$route.params.index}`;
      this.axios.get(url).then((res) => {
        console.log("photo_prodetail的res", res);
        this.data = res.data.data;
      });
    },
  },
  mounted() {
    this.getData();
    this.getRanData()
    // console.log('this.$router',this.$route)
  },
  data() {
    return {
      data: null,
      ranList:null,
    };
  },
};
</script>

<style lang="scss" scoped>
.container {
  width: 1250px;
  margin: 0 auto;
  .prodetail {
  display: flex;
  justify-content: space-between;
  .left {
    width: 60%;
    .title {
      font-size: 30px;
    }
  }
  .right {
    width: 25%;
    h2 {
      margin-bottom: 20px;
    }
  }
}
}
</style>